<?php
/**
*
* Show the product details page
*
* @package	VirtueMart
* @subpackage 
* @author Zbigniew Mazur
* @link http://www.promobico.com
* @copyright Copyright (c) 2011 Promobico limited. All rights reserved.
*/
 
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
?>
{
 	"cart_url" : <?php echo json_encode(JURI::root() . 'index.php?option=com_mvm&task=cart.cart&view=cart&format=json'); ?>,

<?php
/* Let's see if we found the product */
if (empty($this->product)) { ?>
	}
	<?php 
	return; // product not found
} else {
	$product = $this->product; 
	$uriPrefix = JMvmuri::prefix();
			
}
?>

	"name" : <?php echo json_encode($product->product_name);?>,
	"id" : <?php echo json_encode($product->product_id);?>,
	"desc" : <?php echo json_encode($product->product_desc);?>,
	"short_desc" : <?php echo json_encode($product->product_s_desc) ?>,
	"image_url" : <?php echo json_encode(JURI::root().IMAGEURL.'product/'.$product->product_full_image); ?>,
	"image_url_thumb" : <?php echo json_encode(JURI::root().IMAGEURL.'product/'.$product->product_thumb_image); ?>,
	"image_filename" : <?php echo json_encode( $product->product_full_image);?>,
	"image_filename_thumb" : <?php echo json_encode($product->product_thumb_image);?>,
	"num_of_prod" : "<?php echo json_encode ($category->number_of_products); ?>",
	
	"vendor_name" : <?php echo json_encode($product->vendor_name);?>,
	"manufactuer" : <?php echo json_encode($product->manufacturer_id); ?>,
	
	<?php if (_SHOW_PRICES == '1') {?> 
			'salesPrice' : <?php echo json_encode($product->prices['salesPrice']); ?>,
			'basePrice' : <?php echo json_encode($product->prices['basePrice']); ?>,
			'basePriceVariant' : <?php echo json_encode($product->prices['basePriceVariant']); ?>,
			'basePriceWithTax' : <?php echo json_encode($product->prices['basePriceWithTax']); ?>,
			'discountedPriceWithoutTax' : <?php echo json_encode($product->prices['discountedPriceWithoutTax']); ?>,
			'priceBeforeTax' : <?php echo json_encode($product->prices['priceBeforeTax']); ?>,
			'taxAmount' : <?php echo json_encode($product->prices['taxAmount']); ?>,
			'discountAmount' : <?php echo json_encode($product->prices['discountAmount']); ?>,
			'priceWithoutTax' : <?php echo json_encode($product->prices['priceWithoutTax']); ?>,
			'subtotal' : <?php echo json_encode($product->prices['subtotal']); ?>,
			'subtotal_tax_amount' : <?php echo json_encode($product->prices['subtotal_tax_amount']); ?>,
			'subtotal_discount' : <?php echo json_encode($product->prices['subtotal_discount']); ?>,
			'sobtotal_with_tax' : <?php echo json_encode($product->prices['subtotal_with_tax']); ?>,
		    'currency': <?php echo json_encode($product->prices['vendorCurrency'])?>,
			'add_one_to_basket_url' : <?php echo json_encode(JURI::root().'?option=com_mvm&task=cart.add&view=cart&quantity=1&format=json&product_id='. $product->product_id);?>,
	<?php 
	}
	
	$product_packaging = '';
	if ($product->packaging) {
		$product_packaging .= JText::_('VM_PRODUCT_PACKAGING1').$product->packaging;
		if ($product->box) $product_packaging .= '<br />';
	}
	if ($product->box) $product_packaging .= JText::_('VM_PRODUCT_PACKAGING2').$product->box;
					
	$product_packaging = str_replace("{unit}",$product->product_unit ? $product->product_unit : JText::_('VM_PRODUCT_FORM_UNIT_DEFAULT'), $product_packaging);
	?>
	"packaging" : <?php echo json_encode($product_packaging);?>,
	"ask_question_url" : <?php echo json_encode($uriPrefix . JRoute::_('index.php?view=productdetails&task=askquestion&flypage='.JRequest::getVar('flypage').'&product_id='.$product->product_id.'&category_id='.$product->category_id));?>,
	"previous_product_url" : <?php echo json_encode($uriPrefix . JRoute::_('index.php?option=com_virtuemart&format=xml&view=productdetails&product_id='.$product->neighbours['previous']['product_id'].'&category_id='.$product->category_id));?>,
	"next_product_url" : <?php echo json_encode($uriPrefix . JRoute::_('index.php?option=com_virtuemart&format=xml&view=productdetails&product_id='.$product->neighbours['next']['product_id'].'&category_id='.$product->category_id));?>
	
}
